package com.xr.handle;

import com.baomidou.mybatisplus.service.IService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;

/**
 * @author Arnold Yand
 * @summary annotation for call remote service
 * @time 2018/3/26 13:18
 */
public class RemoteServiceProviderHandle extends InstantiationAwareBeanPostProcessorAdapter {

  /**
   * 实例化、依赖注入、初始化完毕时执行
   * @param bean
   * @param beanName
   * @return
   * @throws BeansException
   */
  @Override
  public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof IService) {
      System.out.println(bean.getClass().getSuperclass().getInterfaces()[0].getName() + ":" +bean);
    }
    return super.postProcessAfterInitialization(bean, beanName);
  }
}
